openerp.hfsy_ext = function(instance) {
    openerp.web.form.widgets.add('qq', 'instance.web.form.FieldQQ');

    instance.web.form.FieldQQ = instance.web.form.FieldChar.extend({
        template: 'FieldQQ',
        initialize_content: function() {
            this._super();
            //var $button = this.$el.find('button');
            //$button.click(this.on_button_clicked);
            //this.setupFocus($button);
        },
        render_value: function() {
            this.$el.children('.qq-list').html('');
            if (!this.get("effective_readonly")) {
                this._super();
            } else {
                var value = this.get('value');
                if (value){
                    var numbers = value.match(/\d+/g);
                    if (numbers){
                        for (var i = 0; i < numbers.length; i ++){
                            var number = numbers[i]
                            if (number.length < 5) continue;
                            var url = "http://wpa.qq.com/msgrd?v=3&uin=" + number + '&site=qq&menu=yes';
                            var text = number + '(点击打开QQ聊天窗口)';
                            this.$el.children('.qq-list').append('<a href="' + url + '" target="_blank">' + text + '</a><br />');
                        }
                    }
                }
            }
        },
        on_button_clicked: function() {
        }
    });
};
